<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@include file="/common.jsp"%>
<!DOCTYPE html>
<html lang="zh">
<meta charset="utf-8">
<head></head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-taxpayer-edit">
			<input id="taxpayerId" name="taxpayerId" value="${taxpayer.taxpayerId }" type="hidden">
			<input id="taskId" name="taskId" value="${taskId}" type="hidden">
			<div class="form-group">
				<label class="col-sm-3 control-label">纳税人识别号</label>
				<div class="col-sm-8">
					<input id="taxpayerNumber" name="taxpayerNumber" value="${taxpayer.taxpayerNumber }" class="form-control"
						type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">纳税人名称</label>
				<div class="col-sm-8">
					<input id="taxpayerName" name="taxpayerName" value="${taxpayer.taxpayerName }" class="form-control"
						type="text">
				</div>
			</div>


			<div class="form-group">
				<label class="col-sm-3 control-label">公司名称</label>
				<div class="col-sm-8">
					<input id="taxpayerCompanyName" name="taxpayerCompanyName" value="${taxpayer.taxpayerCompanyName }"
						class="form-control" type="text">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">公司地址</label>
				<div class="col-sm-8">
					<input id="taxpayerAddress" name="taxpayerAddress" value="${taxpayer.taxpayerAddress }"
						class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">电话</label>
				<div class="col-sm-8">
					<input id="taxpayerTel" name="taxpayerTel" value="${taxpayer.taxpayerTel }" class="form-control"
						type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">证件类型：</label>
				<div class="col-sm-8">
					<select id="taxOwnerIdCardType" name="taxOwnerIdCardType" class="form-control">
						<option value="1" ${ taxpayer.taxOwnerIdCardType ==1?'selected':''}>身份证</option>
						<option value="2" ${ taxpayer.taxOwnerIdCardType ==2?'selected':''}>港澳台通行证</option>
						<option value="3" ${ taxpayer.taxOwnerIdCardType ==3?'selected':''}>结婚证</option>
						<option value="4" ${ taxpayer.taxOwnerIdCardType ==4?'selected':''}>驾驶证</option>
						<option value="5" ${ taxpayer.taxOwnerIdCardType ==5?'selected':''}>其他</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">证件号码：</label>
				<div class="col-sm-8">
					<input id="taxOwnerIdCardNum" name="taxOwnerIdCardNum" value="${taxpayer.taxOwnerIdCardNum }"
						class="form-control" type="text">
				</div>
			</div>
			<c:if test="${ not empty taskId}">
				<div class="form-group">
					<label class="col-sm-3 control-label">&nbsp;</label>
					<div class="col-sm-8">
						<a class="btn btn-primary btn-del" onclick="submitHandler()">
							<i class="fa fa-play"></i>
							提交审核
						</a>
					</div>
				</div>
			</c:if>
		</form>
	</div>
	<script type="text/javascript">
		var prefix = "${ctx}/system/taxpayer"
		$("#form-taxpayer-edit").validate({
			rules : {
				taxpayerNumber : {
					required : true,
				},
				taxOwnerIdCardNum : {
					required : true,
					minlength : 2,
					maxlength : 20,
				},
				taxOwnerIdCardType : {
					required : true,
				},
				taxpayerTel : {
					required : true,
					isMobile : true
				},
				taxpayerAddress : {
					required : true,
					minlength : 2,
					maxlength : 20,
				},
				taxpayerCompanyName : {
					required : true,
					minlength : 2,
					maxlength : 20,
				},
				taxpayerName : {
					required : true,
					minlength : 2,
					maxlength : 20,
				},
				taxpayerNumber : {
					required : true,
					minlength : 2,
					maxlength : 20,
				},
			}
		});
	
		function submitHandler() {
			if ($.validate.form()) {
	
				if (!confirm("你确定该操作？")) {
					return;
				}
				$.operate.save(prefix + "/edit", $('#form-taxpayer-edit').serialize(), function(data) {
					if (data.code == 0) {
						alert("操作成功");
						window.location.href = '${ctx}/toDoTask/list/taxpayer';
					}
				});
			}
		}
	</script>
</body>
</html>
